﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGeQuaternion : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGeQuaternion(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGeQuaternion obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGeQuaternion()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGeQuaternion(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGeQuaternion() : this(GlobalsPINVOKE.new_OdGeQuaternion__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeQuaternion(OdGeQuaternion source) : this(GlobalsPINVOKE.new_OdGeQuaternion__SWIG_1(OdGeQuaternion.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeQuaternion(double ww, double xx, double yy, double zz) : this(GlobalsPINVOKE.new_OdGeQuaternion__SWIG_2(ww, xx, yy, zz), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeQuaternion Assign(OdGeQuaternion quat)
		{
			OdGeQuaternion result = new OdGeQuaternion(GlobalsPINVOKE.OdGeQuaternion_Assign(this.swigCPtr, OdGeQuaternion.getCPtr(quat)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeQuaternion set(double ww, double xx, double yy, double zz)
		{
			OdGeQuaternion result = new OdGeQuaternion(GlobalsPINVOKE.OdGeQuaternion_set__SWIG_0(this.swigCPtr, ww, xx, yy, zz), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeQuaternion set(OdGeMatrix3d matrix)
		{
			OdGeQuaternion result = new OdGeQuaternion(GlobalsPINVOKE.OdGeQuaternion_set__SWIG_1(this.swigCPtr, OdGeMatrix3d.getCPtr(matrix)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeMatrix3d getMatrix()
		{
			OdGeMatrix3d result = new OdGeMatrix3d(GlobalsPINVOKE.OdGeQuaternion_getMatrix(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d rotate(OdGePoint3d sourcePoint)
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeQuaternion_rotate__SWIG_0(this.swigCPtr, OdGePoint3d.getCPtr(sourcePoint)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeVector3d rotate(OdGeVector3d vector)
		{
			OdGeVector3d result = new OdGeVector3d(GlobalsPINVOKE.OdGeQuaternion_rotate__SWIG_1(this.swigCPtr, OdGeVector3d.getCPtr(vector)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isEqualTo(OdGeQuaternion quat, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeQuaternion_isEqualTo__SWIG_0(this.swigCPtr, OdGeQuaternion.getCPtr(quat), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isEqualTo(OdGeQuaternion quat)
		{
			bool result = GlobalsPINVOKE.OdGeQuaternion_isEqualTo__SWIG_1(this.swigCPtr, OdGeQuaternion.getCPtr(quat));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool IsEqual(OdGeQuaternion quat)
		{
			bool result = GlobalsPINVOKE.OdGeQuaternion_IsEqual(this.swigCPtr, OdGeQuaternion.getCPtr(quat));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool IsNotEqual(OdGeQuaternion quat)
		{
			bool result = GlobalsPINVOKE.OdGeQuaternion_IsNotEqual(this.swigCPtr, OdGeQuaternion.getCPtr(quat));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double w
		{
			get
			{
				double result = GlobalsPINVOKE.OdGeQuaternion_w_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGeQuaternion_w_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public double x
		{
			get
			{
				double result = GlobalsPINVOKE.OdGeQuaternion_x_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGeQuaternion_x_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public double y
		{
			get
			{
				double result = GlobalsPINVOKE.OdGeQuaternion_y_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGeQuaternion_y_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public double z
		{
			get
			{
				double result = GlobalsPINVOKE.OdGeQuaternion_z_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGeQuaternion_z_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public static OdGeQuaternion kOrigin
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGeQuaternion_kOrigin_get();
				OdGeQuaternion result = (intPtr == IntPtr.Zero) ? null : new OdGeQuaternion(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
